import React from 'react'
import style from './search.module.scss';
import { NavLink } from 'react-router-dom'
import { connect } from 'react-redux'


function Search(props) {
    return (
        <>
            <NavLink to='/shipping'>
                <div className={style.location}>
                    <i className='iconfont icon-location locationIcon'></i>
                    <span className={style.place}>{props.LocationSelected.address || props.currentLocation.name || '未能获取地址'}</span>
                    <i className={style.down}></i>
                </div>
            </NavLink>
            <div className={style.search}>
                <p className={style.searchcontent}><i className='iconfont icon-fangdajing fangdajingIcon'></i>搜索饿了么商家、商品名称</p>
            </div>
        </>
    )
}


const stateToProps = (state) => {
    return {
        LocationSelected: state.shipping.LocationSelected,
        currentLocation: state.region.currentLocation,
    }
}

const dispatchToProps = (dispatch) => {
    return {
    }
}


export default connect(stateToProps, dispatchToProps)(Search)
